/**
 * 分页action
 * @constructor
 * @author neo   
*/
export default class paginationAction {
	constructor(comp) {
		this.comp = comp;
	}
	changePageSize = (newvalue) => {
		const { action, props } = this.comp;
		const { dispatch, transEntry } = props;
		let pgif = transEntry.pageInfo;
		pgif.pageSize = newvalue;
		dispatch({
			type: 'transEntry/update',
			payload: {
				pageInfo: pgif
			}
		});
		if(transEntry.widget){
			setTimeout(() => {
				action.initAction.getWidgetTableData();
			},100)
		}else{
			setTimeout(() => {
				action.initAction.setTableData();
			}, 100);
		}
	};
	changePageNum = (page) => {
		const { action, props } = this.comp;
		const { dispatch, transEntry } = props;
		let pgif = transEntry.pageInfo;
		pgif.pageIndex = page;
		dispatch({
			type: 'transEntry/update',
			payload: {
				pageInfo: pgif
			}
		});
		if(transEntry.widget){
			setTimeout(() => {
				action.initAction.getWidgetTableData();
			},100)
		}else{
			setTimeout(() => {
				action.initAction.setTableData();
			}, 100);
		}
	};
}
